import java.util.Scanner;

class Solution {
//    private String str1;
//    public int firstUniqChar(String s) {
//        int[] count=new int[26];
//        for(int i=0;i<s.length();i++) {
//            count[s.charAt(i)-'a']++;
//        }
//        for(int i=0;i<s.length();i++){
//            if(count[s.charAt(i)-'a']==1) return i;
//        }
//        return -1;
//    }
//
//    public static void main(String[] args) {
//        Scanner scanner=new Scanner(System.in);
//        String str=scanner.nextLine();
//        System.out.println(new Solution().firstUniqChar(str));
//    }


//    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        String str1=sc.nextLine();
//        System.out.println(new Solution().str1.toLowerCase());
//    }

    public static String toLowerCase(String s) {
        char[] chars = s.toCharArray();  // 将字符串转换为字符数组
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] >= 'A' && chars[i] <= 'Z') {
                chars[i] = (char)(chars[i] + 32);  // 转换为小写
            }
        }
        return new String(chars);  // 将字符数组转换回字符串
    }



    public int countSegments(String s) {
        int count = 0;
        boolean inSegment = false;

        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != ' ') {
                if (!inSegment) {
                    count++;
                    inSegment = true;
                }
            } else {
                inSegment = false;
            }
        }
        return count;
    }

    public static int lengthOfLastWord1(String str) {

        //1.直接调用分割方法-》split
        String[] ss=str.split(" ");
        int len=ss[ss.length-1].length();
        return len;
    }

    public static int lengthOfLastWord2(String str) {
        int index=str.lastIndexOf(" ");
        String ret=str.substring(index+1);
        return ret.length();
    }

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String str=scan.nextLine();
//        System.out.println(lengthOfLastWord(str));
        System.out.println(lengthOfLastWord2(str));
    }

    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        System.out.println(new Solution().countSegments(s));
    }



    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String str = Solution.toLowerCase(s);
        System.out.println(str);
    }



}